<@page.html title="定金销售流水查询">
<script type="text/javascript" src="${_appPath!}/js/cal.js"></script>
<script>
  function merge() {
    var arr = [];
    var cbs = document.getElementsByName("cbids");
    if(cbs) {
      for(var i=0; i<cbs.length; i++)
        if(cbs[i].checked) arr.push(cbs[i].value);
    }
    if(arr.length==0) {
      window.alert("请先选择");
      return;
    }
    open('merge?ids='+arr.join(","));
  }

  var _saleId = null;
  function back(id, mm) {
    _saleId = id;
    openWin("getPay?money=-"+mm, 500, 400);
  }
  function payOk(vv) {
    postJson("_back","saleId="+_saleId+"&payls="+encodeURIComponent(vv), backRet);
  }
  function backRet(data) {
    window.alert(data.msg);
    if(data.ret) {
      reloadlist();
    }
  }
</script>
  <div class="search">
    <form id="fm_query" action="_list">
      <dl>
        <dt>门店</dt>
        <dd><script>shopsel('shopCode');</script></dd>
        <dt>定金类型</dt>
        <dd><select name="earnestType"><option value="">全部</option><#if earnestType??><#list earnestType as t><option value="${t.id}">${t.name}</option></#list></#if></select></dd>
        <dt>日期类型</dt>
        <dd><select name="dateType">
          <option value="1">销售日期</option>
          <option value="2">使用日期</option>
        </select></dd>
        <dt>日期范围</dt>
        <dd><input type="text" class="date" name="dateFrom" value="" onfocus="cal(this);" />
          ~ <input type="text" class="date" name="dateTo" value="" onfocus="cal(this);" /></dd>
      </dl>
      <dl>
        <dt>定金编号</dt>
        <dd><input type="text" name="saleId" value="" size="12" /></dd>
        <dt>会员卡号</dt>
        <dd><input type="text" name="cardCode" value="" size="12" /></dd>
        <dt>会员姓名</dt>
        <dd><input type="text" name="custName" value="" size="12" /></dd>
        <dt>是否使用</dt>
        <dd><select name="status"><option value="">全部</option><#if earnestStatus??><#list earnestStatus as t><option value="${t.id}">${t.name}</option></#list></#if></select></dd>
        <dd class="button"><input type="button" value="查询" onclick="query();"></dd>
        <#if canExpt??><dd class="button"><input type="button" value="导出" onclick="expt();"></dd></#if>
        <dd class="oper"><#if canMerge??><a class="add" href="javascript:merge();">定金合并</a></#if></dd>
      </dl>
    </form>
  </div>
  <div id="div_list"></div>
<script type="text/javascript">query();</script>
</@page.html>